<template>
    <div id="app">
        <h1 v-text="msg" ref="title"></h1>
        <button ref="btn" @click="showDOM">点我输出上方的dom元素</button>
        <school ref="zujian"></school>
    </div>
</template>

<script>

import School from "./components/School.vue";

export default {
    name: "App",
    components: {
        School
    },
    data() {
        return {
            msg : "欢迎学习Vue"
        }
    },
    methods: {
        showDOM() {
            // id的替代者
            console.log(this.$refs.title) // <h1>欢迎学习Vue</h1>
            console.log(this.$refs.btn) // <button>点我输出上方的dom元素</button>
            console.log(this.$refs.zujian) // 拿到的是组件实例的对象， 原声的拿到的是组件整个html标签
        }
    }
}
</script>

<style>

</style>
